<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <title></title>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge">
    <link rel="stylesheet" type="text/css" href="../resources/css/bootstrap.css">
    <link rel="stylesheet" type="text/css" href="../resources/css/bootstrap-datetimepicker.min.css">
    <link rel="stylesheet" href="../resources/css/grumble.css">

    <script type="text/javascript" src="../resources/scripts/jquery.1.8.3.js"></script>
    <script type="text/javascript" src="../resources/scripts/bootstrap.js"></script>
    <script type="text/javascript" src="../resources/scripts/bootstrap-datetimepicker.min.js"></script>
    <script type="text/javascript" src="../resources/scripts/bootstrap-datetimepicker.zh-CN.js"></script>
    <script type="text/javascript" src="../resources/scripts/jquery.grumble.min.js"></script>
    <script type="text/javascript" src="../resources/scripts/zhBase.js"></script>
    <script type="text/javascript" src="../resources/scripts/zhForm.js"></script>
    <script charset="utf-8" src="../resources/scripts/kindeditor-4.1.1/kindeditor-min.js"></script>
    <script charset="utf-8" src="../resources/scripts/kindeditor-4.1.1/lang/zh_CN.js"></script>

    <%--文件上传插件--%>
    <link href="../resources/scripts/XYTipsWindow/jquery.XYTipsWindow.2.8.css" rel="stylesheet"/>
    <link href="../resources/scripts/webuploader/webuploader.css" rel="stylesheet"/>
    <link href="../resources/scripts/webfilesuploader/webfilesuploader.css" rel="stylesheet"/>
    <script src="../resources/scripts/webuploader/webuploader.js"></script>
    <script src="../resources/scripts/XYTipsWindow/jquery.XYTipsWindow.2.8.js"></script>
    <script src="../resources/scripts/webfilesuploader/webfilesuploader.js"></script>
    <script src="../resources/scripts/download/fileUpload.js"></script>
    <script>
        $(function () {

            /**
             * 提交后的响应函数
             * @param data 服务器返回
             */
            function deal(data) {
                if("1"==data.status){
                    alert("保存成功");
                    window.location.href="/sys/content/index.do";
                }
                else{
                    alert("保存失败");
                }
            }

            var zf = new zhForm($("#formId"));
            $("#btnid").click(function () {
                var isSuccess = zf.verify();
                if (isSuccess) {
                    zf.submitForm(deal);
                }
            });
        });

        var editor;
        KindEditor.ready(function (K) {
            editor = K.create('textarea[name="content"]', {
                resizeType:0,
                allowPreviewEmoticons:false,
                allowUpload:true,
                //是否可以弹出对话框选择文件
                allowFileManager:true,
                //文件选择的时候弹出的对话框/对话框中可以放置服务器图片文件
                allowImageUpload:true,
                uploadJson:"/file/imageUpload.do",
                syncType:"absolute",
                items:['source', '|', 'fullscreen', 'undo', 'redo', 'print', 'cut', 'copy', 'paste',
                    'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright',
                    'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript',
                    'superscript', '|', 'selectall','title', 'fontname', 'fontsize', '|', 'textcolor',
                    'bgcolor', 'bold', 'italic', 'underline', 'strikethrough', 'removeformat', '|'
                    , 'advtable', 'hr', 'emoticons',  'image', 'insertfile','link', 'unlink'],
                afterCreate:function () {
                    var self = this;
                    K.ctrl(document, 13, function () {
                        self.sync();
                        document.forms['form'].submit();
                    });
                    K.ctrl(self.edit.doc, 13, function () {
                        self.sync();
                        document.forms['form'].submit();
                    });
                },
                afterBlur:function () {
                    this.sync();
                }
            });
        });
    </script>
</head>
<BODY class="mian_bg">
<TABLE cellSpacing=0 cellPadding=0 width="100%" align=center border=0>
    <TR height=28>
        <TD class="addr_td">&nbsp;&nbsp;<img src="/sys/resources/images/addr_icon.png">&nbsp;当前位置: 学习>编辑学习内容</TD>
    </TR>
    <TR>
        <TD bgColor=#7ca600 height=1></TD>
    </TR>
    <TR>
        <TD bgColor=#8ebe00 height=1></TD>
    </TR>
</TABLE>

<div class="container">
    <div class="panel panel-default">
        <div class="panel-heading">
            <h3 class="panel-title">编辑学习内容</h3>
        </div>
        <div class="panel-body">
            <form action="/sys/content/editData.do" id="formId" class="form-horizontal" role="form">
                <div class="row">
                    <div class="col-xs-8">
                        <div class="form-group">
                            <label for="title" class="col-sm-3 control-label">标题</label>
                            <div class="col-sm-9">
                                <input name="id" type="hidden" value="${obj.id}" />
                                <input name="title" type="text" notNull="true" value="${obj.title}" class="form-control" id="title" placeholder="标题">
                            </div>
                        </div>
                    </div>
                </div>

                <div class="row">
                    <div class="col-xs-8">
                        <div class="form-group">
                            <label for="type" class="col-sm-3 control-label">类型</label>
                            <div class="col-sm-9">
                                <select name="type" id="type" class="form-control" notNull="true">
                                    <option value="1"<c:if test="${obj.type}=='1'">selected="selected"</c:if>>职业能力知识</option>
                                    <option value="2"<c:if test="${obj.type}=='2'">selected="selected"</c:if>>培训课件</option>
                                    <option value="3"<c:if test="${obj.type}=='3'">selected="selected"</c:if>>培训视频</option>
                                    <option value="4"<c:if test="${obj.type}=='4'">selected="selected"</c:if>>示范教学片</option>
                                </select>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="row">
                    <div class="col-xs-8">
                        <div class="form-group">
                            <label for="time" class="col-sm-3 control-label">学习时间(分钟)</label>
                            <div class="col-sm-9">
                                <input name="time" id="time" type="text" isNumber="true" value="${obj.time}" class="form-control" placeholder="学习时间">
                            </div>
                        </div>
                    </div>
                </div>

                <div class="row">
                    <div class="col-xs-8">
                        <div class="form-group">
                            <label for="realname" class="col-sm-3 control-label">学习文件</label>
                            <div class="col-sm-7">
                                <input name="url" type="hidden" id="url"  />
                                <input name="realname" id="realname" value="${obj.realname}" type="text" class="form-control"
                                       placeholder="学习文件" />
                            </div>
                            <div class="col-sm-2">
                                <button id="fileBtn" type="button" class="btn btn-info btn-sm">选择文件</button>
                            </div>
                        </div>
                    </div>
                </div>


                <div class="row">
                    <div class="col-xs-8">
                        <div class="form-group">
                            <label for="content" class="col-sm-3 control-label">所属课程</label>

                            <div class="col-sm-9">
                                <div class="checkbox">
                                    <c:forEach var="item" items="${curriculumList}">
                                        <label>
                                            <input name="currId" notNull="true" value="${item.id}" type="checkbox"
                                            <c:if test="${item.isSelected==1}">checked </c:if>  > ${item.title}
                                        </label>
                                    </c:forEach>

                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="row">
                    <div class="col-xs-8">
                        <div class="form-group">
                            <label for="content" class="col-sm-3 control-label">学习内容</label>

                            <div class="col-sm-9">
                                <textarea name="content" class="form-control" notNull="true" id="content" rows="30">${content}</textarea>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="row">
                    <div class="col-xs-2">
                    </div>
                    <div class="col-xs-4">
                        <button type="button" id="btnid" class="btn btn-success btn-block">提交</button>
                    </div>
                    <div class="col-xs-2">
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
</body>
</html>


